package com.jx.mlxg.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jx.mlxg.entity.OrderDetails;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
* @author Administrator
* @description 针对表【order_details】的数据库操作Mapper
* @createDate 2025-02-25 21:21:07
* @Entity entity.entity.OrderDetails
*/
@Mapper
public interface OrderDetailsMapper extends BaseMapper<OrderDetails> {
    /**
     * 获取包含特定产品的所有订单ID
     * @param productId 产品ID
     * @return 包含该产品的所有订单ID集合
     */
    default List<String> getOrderIdsByProductId(Integer productId) {
        return selectObjs(new QueryWrapper<OrderDetails>()
                .select("order_id")
                .eq("product_id", productId));
    }
}




